import java.util.*;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: lenovo
 * Date: 2022-09-12
 * Time: 14:11
 */
public class Test {
    public static void main(String[] args) {
        //map是一个接口,不能实例化对象,只能实现向上转型
        //统计单词出现的次数
        Map<String,Integer> map = new TreeMap<>();//treemap底层是一个红黑树,时间复杂度logn
        Map<String,Integer> map2 = new HashMap<>();//hashmap底层是一个hash表
        map.put("dkokdo",10);
        map.put("dkokdo",8);
        map.put("asa",90);
        map.put("a",90);
        System.out.println(map);
        Collection<Integer> list = map.values();
        System.out.println(list);
        Set<String> set00=  map.keySet();
        System.out.println(set00);





        Set<Map.Entry<String,Integer>> set =  map.entrySet();



        //统计有多少个不重复的单词
        Set<String> set0 = new TreeSet<>();//treeset底层是一颗红黑树
        Set<String> set1 = new HashSet<>();//hashset底层是一个hash表

    }
}
